﻿@{
	ViewBag.Title = "Form";
	Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
	layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
		var form = layui.form,
			$ = layui.$,
			common = layui.common;
		//权限字段
		common.authorizeFields('adminform');
		wcLoading.close();
		//监听提交
		form.on('submit(saveBtn)', function (data) {
				var postData = data.field;
				var codeArray= postData.Code.split(',');
				
				for (let i = 0; i < codeArray.length; i++) {
					var obj = {
						Id: 0,
						Code: codeArray[i]
					};

					common.submitForm({
						url: "/STZBManage/Ssqh/SubmitForm",
						param: obj,
						success: function () {
							if (i === codeArray.length - 1) {
								common.parentreload("data-search-btn");
							}
						}
					});
				}
			return false;
		});
	});
</script>
<body>
	<div class="layuimini-container ">
		<div class="layuimini-main">
			<div class="layui-form layuimini-form" lay-filter="adminform">
				<div class="layui-form-item layui-hide">
					<label class="layui-form-label required">区号</label>
					<div class="layui-input-block">
						<input type="text" id="Code" name="Code" placeholder="请输入区号、多值使用英文状态下,号隔开" maxlength="100" lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item layui-hide">
					<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
				</div>
			</div>
		</div>
	</div>
</body>
